<?php
	if(!isset($id))
	{
		$set_tgl_awal	= set_value("tanggal_awal");
		$set_tgl_akhir	= set_value("tanggal_akhir");
		$set_keterangan	= set_value("keterangan");
	}
	else
	{
		$set_tgl_awal	= $data_periode["TGL_AWAL"];
		$set_tgl_akhir	= $data_periode["TGL_AKHIR"];
		$set_keterangan	= $data_periode["KETERANGAN"];
	}
?>
<style>
label{
	text-align:right;
}
</style>
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4>
					<span>Form Master Periode</span>
				</h4>
			</div>
			<div class="panel-body">
				<?php echo form_open($post_action);?>
					<div class="form-group">
						<label class="col-lg-3 control-label" for="input">Tanggal Awal</label>
						<div class="col-lg-2">
							<input type="text" name="tanggal_awal" id="tanggal_awal" class="form-control elastic" value="<?php echo date('d-m-Y',strtotime($set_tgl_awal));?>">
						</div>
						<font color="red"><?php echo form_error("tanggal_awal"); ?></font>
						<label class="col-lg-2 control-label" for="input">Tanggal Akhir</label>
						<div class="col-lg-2">
							<input type="text" name="tanggal_akhir" id="tanggal_akhir" class="form-control elastic" value="<?php echo date('d-m-Y',strtotime($set_tgl_akhir));?>">
						</div>
						<font color="red"><?php echo form_error("tanggal_akhir"); ?></font>
					</div>
					<br>
					<br>
					<br>
					<div class="form-group">
						<label class="col-lg-3 control-label" for="input">Keterangan</label>
						<div class="col-lg-6">
							<textarea class="form-control elastic" id="keterangan" name="keterangan" rows="3"><?php echo $set_keterangan;?></textarea>
						</div>
						<font color="red"><?php echo form_error("keterangan"); ?></font>
					</div>
					<br>
					<br>
					<br>
					<div class="form-group">
						<div class="col-lg-offset-3 col-lg-9">
							<button type="submit" class="btn btn-info">Simpan</button>
							<button type="reset" class="btn btn-warning">Reset</button>
							<button type="button" class="btn btn-default" onClick="kembali()">Kembali</button>
						</div>
					</div>
				<?php echo form_close();?>
			</div>
		</div>
	</div>
</div>
<script>
function kembali(){
	document.location="<?php echo site_url("master/grid_periode");?>";
}
$(document).ready(function (){
	if($('#tanggal_awal').length) {
		$('#tanggal_awal').datepicker({
	        inline: true,
			dateFormat:"dd-mm-yy",
			showOtherMonths:true
	    });
	}
	if($('#tanggal_akhir').length) {
		$('#tanggal_akhir').datepicker({
	        inline: true,
			dateFormat:"dd-mm-yy",
			showOtherMonths:true
	    });
	}
});
</script>